home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2614.ZIP
/
DISPLA.ZIP
/
DISPLAY.DOC
< prev
next >
Wrap
Text File
|
1990-12-22
|
11KB
|
207 lines
DispFile() version 5.0 23 Dec 1990
DispFile() and assorted routines created by me for the public domain.
DISPLAY.EXE is a self-extracting ZIP file -- see the list at the
bottom of this doc for details.
Author: Mike Taylor CIS: 73310,3013
300 W. Main St.
Maple Shade, NJ 08052 Work: (215) 563-9000 x2281
Function:
Summer 87
DispFile(cInFile, nTop, nLeft, nBottom, nRight,
nStart, nCNormal, nCHighlight, cExitKeys,
lBrowse, [nColSkip], [nRMargin] )
Clipper 5.0
DispFile(cInFile, nTop, nLeft, nBottom, nRight,
nStart, nCNormal, nCHighlight, cExitKeys,
lBrowse, [nColSkip], [nRMargin], [nBuffSize )
Parameters:
cInFile - text file to display (full name)
nTop - upper row of window
nLeft - left col of window
nBottom - lower row of window
nRight - right col of window
nStart - line to place highlight at startup
nCNormal - normal text color (numeric attribute)
nCHighlight - text highlight color (numeric attribute)
cExitKeys - terminating keys
lBrowse - browse flag
nColSkip - col increment for left/right arrows
nRMargin - right margin - data is truncated if
it falls to the right of nRMargin.
defaults to 255 if not passed.
for Summer 87 max is 255.
nBuffSize - Clipper 5.0 only -- sets the size of
the paging buffer. defaults to 4096
if not passed.
Returns: char value - the key that terminated DispFile()
Purpose: to display a text file within a defined window
using as little memory as possible. the text
file to display has to be present or an error
value of 0 is returned (as a character.)
ASSUMPTIONS: the routine assumes that all lines are terminated
with a CR/LF sequence (0x0d and 0x0a).
in the Summer 87 version the page buffer size is 4096
chars and the max line length is 255 characters.
Cursor Keys: Up, Down - moves the highlight line
Left, Right - moves the window over nColSkip col's
Home - moves the window to the far left
End - moves the window to the nRMargin column
PgUp, PgDn - moves the highlight one page
Ctrl-PgUp - moves the highlight to the file top
Ctrl-PgDn - moves the highlight to the file bottom
Ctrl-Right - moves the window 16 col's to the right
Ctrl-Left - moves the window 16 col's to the left
Esc, Return - terminates the function
all other keys are ignored unless they are specified
within cExitKeys parameter. This list will tell the
routine what keys terminate the function. Special
keys must be passed by a unique value and that value
can be found by looking in the keys.h file. See the
test program for an example.
I don't guarantee anything about these routines except that if you find
a bug or want something changed and you don't have access to a C
compiler, then give me a shout and I'll see what I can do.
This routine has been compiled with MSC 5.1. It does utilize the newer
ANSI C ideas (prototypes, etc.) but all of that has been placed in the
.h files. The only part that can be called from Clipper is the main
routine DispFile(). The screen update code writes directly to screen
memory and the dispsub.asm file contains the file I/O routines.
If you want to recompile the c code, make sure you define the CLIPPER5
manifest constant at the head of display.c if you want the Clipper 5.0
version of DispFile() and then rename the display.obj file to either
disp_s87.obj or disp_50.obj as required.
WARNING: If you want to use TLink to link the .obj's then you should
compile the C routine (display.c) with the appropriate version
of Turbo C so that the resulting .obj file is 100% compatible.
Evidently Turbo C's large memory model is not completely
compatible with Microsoft's. This problem has not been tested
completely but one of the 'bugs' vanished whenever I did this.
Thanks to Gene Winston for discovering this psuedo-bug.
I've tested this routine on the following hardware with no problems:
Gateway 386SX w/VGA mono & color modes
IBM PC-AT w/mono
IBM PC-AT w/CGA
IBM PC-AT w/VGA mono & color modes (Dell VGA Color Plus)
IBM PS/2 m60 w/VGA mono & color modes
All public symbols are preceded by a 'd_' so you don't have to worry
about any conflicts with your symbols (unless you happen to have a 'd_'
in front of any!)
Release Notes:
5.0 23 Dec 90 - converted code to run with Clipper 5.0 and S87
- removed once again the debug code
- most variables are global for speed reasons
- the PgUp/PgDn keys work in a more normal fashion
(the highlight stays on the same line and the
page changes one full page)
- changed all screen i/o asm routines into c code
for speed reasons
- the 5.0 version uses _xalloc() to grab memory
for the page and line buffers
- revised documentation
2.1 01 Nov 89 - brought back the debugging code, but this time
made it an #ifdef set of clauses that allow
the debug info to be written to the mono video
area if the cga is active and vice versa.
The active video area can be swapped using the
F4 key (CodeView people should be happy.) The
.obj files by default have all debug info
turned off so if you want it, you'll have to
compile
- the version also fixed a problem that was
occuring when you pressed line_down on some
really large files with large line sizes.
Thanks to Paul Corrigan and Jack Zakarian at
the IMC Systems Group, Inc. for spotting the
bug and sending me some sample code to test
2.0 28 Sep 89 - added lBrowse which is a flag to change the
way the routine processes the up/down arrows;
if it is .T., then the up/down arrows will
scroll the window one line up/down and if it
is .F., it will screen one line up/down only
when the highlight is at the bottom/top of the
window
- nColSkip and nRMargin will now default to 1 and
132 respectively if they are not present in
the parameter list
- fixed a bug in 1.95 that caused my debugging data
to be written to the mono screen (I forgot to
comment out the code)
1.95 27 Sep 89 - added nColSkip and nRMargin parameters
1.9 12 Sep 89 - reality check release - recompiled all of the
code and retested everything to make sure it
all still works.
1.8 17 Mar 89 - set up the keyboard routine to accept a string
of char values to terminate the function when
pressed
1.7 13 Mar 89 - increased the buffer size to 4096 bytes so that
Gene could display one of his files. It turned
out that only 4 or 5 of his lines (> 100 chars)
could fit in the buffer and yet for some reason
(<g>), the pseudo-window routine was expecting
8. Also rewrote some of the line-up/down code
to treat buffer boundaries a little cleaner
(not efficient, but easier)
1.6 22 Feb 89 - fixed cursor-past-file-end bug when the file size
was within a couple of bytes of the buffer size
- fixed some errors in the documentation
1.5 14 Jan 89 - initial release.
Files included in DISPLAY.EXE:
DISPLAY DOC the file you are reading
DISPLAY C contains DispFile() and c routines
DISPSUB ASM contains asm routines
TEST_S87 PRG test programs to show DispFile() call
TEST_50 PRG
DISPLAY MAK make file to create DispFile() .obj files
TEST_S87 MAK make files to create test program
TEST_50 MAK
DISPLAY LNK sample link file for Blinker
DISP_S87 OBJ Summer 87 version object file for DispFile()
DISP_50 OBJ Clipper 5.0 version object file for DispFile()
DISPSUB OBJ assembler routines object file
DISPLAY H include files
DISPSUB H
KEYS H include file for key #defines